package com.applet.applet_shangcheng.dao;

import com.applet.applet_shangcheng.entity.QualityGoods;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface QualityGoodsMapper {
    @Insert({
            "insert into tb_quality_goods (goods_code,create_date,scan_the_code,status,note) values ( #{goodsCode},#{createDate},#{scanTheCode},#{status},#{note})"
    })
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insertQualityGoods(QualityGoods qualityGoods);
    @Select({
            "select id,goods_code,create_date,scan_the_code,status,note from tb_quality_goods where goods_code=#{goodsCode}"
    })
    QualityGoods findByCode(@Param("goodsCode") String goodsCode);

    @Update({
            "update tb_quality_goods set scan_the_code=#{scanTheCode},status=#{status},note=#{note} where goods_code=#{goodsCode}"
    })
    int updateQualityGoods(QualityGoods qualityGoods);

    List<QualityGoods> findAll(String queryString);

    @Delete({
            "delete from tb_quality_goods where id = #{id}"
    })
    int deleteCode(@Param("id")String id);

    @Select({
            "select id,goods_code,create_date,scan_the_code,status,note from tb_quality_goods where id=#{id}"
    })
    QualityGoods findById(@Param("id") int id);

    @Update({
            "update tb_quality_goods set  status=#{status},note=#{note} where goods_code=#{goodsCode}"
    })
    int update(QualityGoods qualityGoods);
}